﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace XH.BMS.Views.Pages
{
    /// <summary>
    /// TrendPage.xaml 的交互逻辑
    /// </summary>
    public partial class TrendPage : UserControl
    {
        public TrendPage()
        {
            InitializeComponent();
            this.Loaded += TrendPage_Loaded;
        }

        private void TrendPage_Loaded(object sender, RoutedEventArgs e)
        {
            //double[] values = new double[1000];
            //Random random = new Random();
            //for (int i = 0; i < 1000; i++)
            //{
            //    values[i] = random.NextDouble() * 100;
            //}
            //this.wpfPlot.plt.AddSignal(values);

            //this.wpfPlot.Refresh();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // string filePath, 将要保存的图像的文件名称 jpg bmp png
            // int? width = null, 图像的宽度
            // int? height = null, 图像的高度
            // bool lowQuality = false, 图像的质量
            // double scale = 1.0 图像的缩放比

            // 保存图像
            wpfPlot.plt.SaveFig($"{AppDomain.CurrentDomain.BaseDirectory}\\Images\\{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.jpg");
        
            // LiveCharts 基于窗口的某个控件进行
        }
    }
}
